import numpy as np


def Sigmoid(x):
    if x >= 0:
        return 1
    if x < 0:
        return 0


class Neuron:
    def __init__(self, weights, bias):
        self.weights = weights
        self.bias = bias

    def feedforward(self, inputs):
        total = np.dot(self.weights, inputs) - self.bias
        print(total)  # 4
        return Sigmoid(total)


weights = np.array([5, 3, 2])  # w1=5, w2=3, w3=2
bias = 3  # 偏移
n = Neuron(weights, bias)

x = np.array([1, 0, 1])  # x1=1, x2=0, x3=1
print(n.feedforward(x))  # 1
